#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using i128 = __int128;
const int N = 1e6 + 5;

void solve() {
    int n, x;
    ll k;
    cin >> n >> k >> x;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int kk=k%x;
    for(int i=0;i<x;i++){
        cout<<a[(i-kk+x)%x]<<" ";
    }
    for(int i=x;i<n;i++){
        cout<<a[i]<<" ";
    }
    cout<<endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();

    return 0;
}